/**
 * Company : Thai Informatic System Co., Ltd.
 * Created By : Dr.Tree
 * Created On : May 25, 2012  3:18:48 PM 
 * e-Mail : chatree@tis.co.th
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : apps.business.process.sales.contract
 * File Name : SalesContractSingleProcessing.java
 * TODO
 */
package apps.business.process.sales.contract;

import java.util.List;

import jpa.entitys.synchro.staging.SdCustoRequDeducOutb;

import org.apache.log4j.Logger;

import sap.business.sd.outbound.VwSyncMktBankDeduRequService;

import apps.business.process.sales.booking.SalesBookingProcessing;
import apps.promis.out.sales.VwSyncMktBankDeduRequAction;

/**
 * @author chatree
 *
 */
public class SalesContractSingleProcessing {
	
	
	private static final Logger log = Logger.getLogger(SalesContractSingleProcessing.class);

	/**
	 * 
	 */
	public SalesContractSingleProcessing() {
		// TODO Auto-generated constructor stub
	}
	
	/**
	 * 			String company = "SP";
				String project = "SPLVILLE-PRAGSA";  //SPLVILLE-PRAGSA
				String BookingOrContarctNo = "CS-1206-000021-0"; //"CS-1204-000009-0" //"BS-1204-000007"; //"BS-1204-000016"
				String status = "A";
				String syncIsstaging = null; //Can set value to [null]
				String issync = "N";
	 * @param company
	 * @param project
	 * @param BookingOrContarctNo
	 * @param status
	 * @param syncIsstaging
	 * @param issync
	 * @throws Exception
	 */
	public void Processing(String company, String project, String BookingOrContarctNo, String status, String syncIsstaging, String issync) throws Exception {
		try{
			
			new SalesBookingProcessing().newProcessingSingle(company, project, BookingOrContarctNo, status, syncIsstaging, issync);
			
		}catch(Exception e){
			System.err.println("" + e.getMessage());
			log.error(e.getMessage());
			throw e;
		}
	}
	
	@Deprecated
	private void Start() throws Exception {
		try{
			
			SalesBookingProcessing obj = new SalesBookingProcessing();

			for(int i = 0; i < 100; i++){
				String company = "SP";
				String project = "SPLVILLE-PRAGSA";  //SPLVILLE-PRAGSA
				String BookingOrContarctNo = "CS-1206-000021-0"; //"CS-1204-000009-0" //"BS-1204-000007"; //"BS-1204-000016"
				String status = "A";
				String syncIsstaging = null; //Can set value to [null]
				String issync = "N";
				
				obj.newProcessingSingle(company, project, BookingOrContarctNo, status, syncIsstaging, issync);
			}
			
			
			/*
			
			VwSyncMktBankDeduRequAction objoo = new VwSyncMktBankDeduRequAction();
			//Save Data to Staging
			log.info("Start Create Sales Deduction Request to Staging --------------------------------------> ");
			List<SdCustoRequDeducOutb> SdCustoRequDeducOutb_lst = objoo.CreateToStaging(company, project, BookingOrContarctNo, status, syncIsstaging);
			log.info("End Create Sales Deduction Request to Staging --------------------------------------> ");
			
			//Sending to SAP
			log.info("Start Sending Sales Deduction Request to SAP --------------------------------------> ");
			new VwSyncMktBankDeduRequService().SendingToSAP(SdCustoRequDeducOutb_lst);
			log.info("End Sending Sales Deduction Request to SAP --------------------------------------> ");
			
			*/
			
		}catch(Exception e){
			log.error(e.getMessage());
			System.err.println(e.getMessage());
			throw e;
		}
	}

//	/**
//	 * @param args
//	 */
//	public static void main(String[] args) {
//		// TODO Auto-generated method stub
//		
//		try{
//			
//			new SalesContractSingleProcessing().Start();
//			
//		}catch(Exception e){
//
//			e.printStackTrace();			
//		}
//	}

}
